package com.example.userprovider.service;

import cn.example.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserService
 * @Description TODO
 * @Author yaozhaobao
 * @Date 2020/7/13 12:42
 * @Version 1.0
 **/

@RestController
@Slf4j
public class UserService {


    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public boolean login(@RequestParam String username, @RequestParam String password) {

        //数据库中查询数据
        if ("zhangsan".equals(username) && "123456".equals(password)) {
            return true;
        } else {
            return false;

        }

    }


    @RequestMapping(value = "/login3", method = RequestMethod.POST)
    public boolean login3(@RequestParam Integer count) {
        log.info("程序进入了user-provider,第" + count + "次请求");
        return true;
    }

    @RequestMapping(value = "/login2",method = RequestMethod.POST)
    public boolean login2(@RequestBody User user){

        //数据库中查询数据
        if("zhangsan".equals(user.getName())&&"123456".equals(user.getPassword())){
            return true;
        }else{
            return  false;

        }

    }





}
